home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
-
- cCrate::cCrate(int _x, int _y, cProperties *_orig)
- : cWeapon(_x, _y, _orig, "MOVING")
- {
- move_object_after_hit = FALSE;
-
- ASSERT(!crate_contents_list.is_empty());
- }
-
- cCrate::~cCrate()
- {
- }
-
- int cCrate::control()
- {
- cWeapon::control();
-
- bounce_on_boundaries();
-
- // If hit drop stuff down
-
- if (explode)
- {
- int n = orig->params->get_int("*OBJECTS_INSIDE", 5);
-
- for (int i = 0; i < n; i++)
- {
- cFalling *f = new cFalling (x, y, crate_contents_list.get_random());
- f->add_angular_speed(150, (96 + i * 192 / (n - 1)) & 255);
- }
-
- return FALSE;
- }
-
- return !in_water();
- }
-